package com.hankol.message.adapter

import android.widget.ImageView
import com.baselibrary.extension.*
import com.baselibrary.utils.CommonUtil
import com.baselibrary.utils.TimeUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hankol.message.R
import com.hankol.message.bean.GetSysMsgListBean

/*消息主页-广播 列表
* */
class BroadcastMsgListAdapter : BaseQuickAdapter<GetSysMsgListBean, BaseViewHolder>(R.layout.item_broadcast_msg) {

    override fun convert(helper: BaseViewHolder, item: GetSysMsgListBean) {
        helper.apply {
            item.let {
                setText(R.id.tv_time, TimeUtil.fromToday(it.lastCtime))
                setText(R.id.tv_brocast_title, it.name.checkValue())
                setText(R.id.tv_brocast_content, it.lastContent.checkValue())
                setGone(R.id.tv_red_dot_brocast, it.unreadCount > 0)
                getView<ImageView>(R.id.img_heard).loadCircleGif(mContext, it.icon.checkValue())
                getView<ImageView>(R.id.img_lebel).load(mContext, it.label.checkValue())
            }
            CommonUtil.formatNum99(getView(R.id.tv_red_dot_brocast), item.unreadCount)
        }
    }
}